package Administrator.AdministratorMainFrame.AdministratorMainFrameView.ConfigureContestPane.GenerateAccountsFrame;

import java.awt.EventQueue;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.UIManager;

import java.awt.event.*;

public class GenerateAccountsFrame 
{

	private JFormattedTextField startNumberFormattedTextField;
	private JFormattedTextField ScoreBoardsFormattedTextField;
	private JFormattedTextField TeamsFormattedTextField;
	private JFormattedTextField administratorsFormattedTextField;
	private JFrame frame;
	
	private JButton generateButton;
	private JButton exitButton;
    
	public JButton getGenerateButton()
	{
		return this.generateButton;
	}
	
	/**
	 * Launch the application
	 * @param args
	 */
	public static void main(String args[]) 
	{
		try
		{
		    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		EventQueue.invokeLater(new Runnable() 
		{
			public void run() {
				try {
					GenerateAccountsFrame window = new GenerateAccountsFrame();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application
	 */
	public GenerateAccountsFrame() 
	{
		try
		{
		    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		createContents();
		
		frame.setVisible(true);
	}

	/**
	 * Initialize the contents of the frame
	 */
	private void createContents() 
	{
		frame = new JFrame();
		frame.getContentPane().setLayout(null);
		frame.setTitle("Generate Accounts(auto)");
		frame.setBounds(100, 100, 383, 382);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		final JLabel administratorLabel = new JLabel();
		administratorLabel.setFont(new Font("", Font.BOLD, 14));
		administratorLabel.setText("Administrators");
		administratorLabel.setBounds(54, 56, 127, 22);
		frame.getContentPane().add(administratorLabel);

		administratorsFormattedTextField = new JFormattedTextField();
		administratorsFormattedTextField.setBounds(174, 57, 144, 21);
		frame.getContentPane().add(administratorsFormattedTextField);

		final JLabel teamLabel = new JLabel();
		teamLabel.setFont(new Font("", Font.BOLD, 14));
		teamLabel.setText("Teams");
		teamLabel.setBounds(54, 105, 85, 22);
		frame.getContentPane().add(teamLabel);

		TeamsFormattedTextField = new JFormattedTextField();
		TeamsFormattedTextField.setBounds(174, 106, 144, 21);
		frame.getContentPane().add(TeamsFormattedTextField);

		final JLabel scoreBoardLabel = new JLabel();
		scoreBoardLabel.setFont(new Font("", Font.BOLD, 14));
		scoreBoardLabel.setText("ScoreBoards");
		scoreBoardLabel.setBounds(54, 156, 97, 15);
		frame.getContentPane().add(scoreBoardLabel);

		ScoreBoardsFormattedTextField = new JFormattedTextField();
		ScoreBoardsFormattedTextField.setBounds(174, 153, 144, 21);
		frame.getContentPane().add(ScoreBoardsFormattedTextField);

		final JLabel startAccountNumberLabel = new JLabel();
		startAccountNumberLabel.setFont(new Font("", Font.BOLD, 14));
		startAccountNumberLabel.setText("Start Account number from");
		startAccountNumberLabel.setBounds(54, 214, 188, 15);
		frame.getContentPane().add(startAccountNumberLabel);

		startNumberFormattedTextField = new JFormattedTextField();
		startNumberFormattedTextField.setBounds(174, 235, 144, 21);
		frame.getContentPane().add(startNumberFormattedTextField);

		generateButton = new JButton();
		generateButton.setText("Generate");
		generateButton.setBounds(52, 295, 99, 23);
		frame.getContentPane().add(generateButton);

		exitButton = new JButton();
		exitButton.setText("Exit");
		exitButton.setBounds(207, 295, 99, 23);
		
		frame.getContentPane().add(exitButton);

		final JLabel pleaseSelectAccountLabel = new JLabel();
		pleaseSelectAccountLabel.setFont(new Font("", Font.PLAIN, 14));
		pleaseSelectAccountLabel.setText("Please select account type and number");
		pleaseSelectAccountLabel.setBounds(54, 21, 252, 15);
		frame.getContentPane().add(pleaseSelectAccountLabel);
		
		this.exitButton.addActionListener(new ExitButtonListener(this.frame));
	}
}
class ExitButtonListener implements ActionListener
{
	public ExitButtonListener(JFrame frame)
	{
		this.frame = frame;
	}
    public void actionPerformed(ActionEvent event)
    {
    	this.frame.setVisible(false);
    }
    private JFrame frame;
}
